package com.rgst.dao.entity;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * Created by tancw on 2019/11/24.
 */
@Entity
@Table(name = "rgst_enroll")
public class Enroll {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    @Column(name = "dep", nullable = false)
    private String dep;
    @Column(name = "stuid", nullable = false)
    private Long stuId;
    @Column(nullable = false)
    private String grade;
    @Column(name = "classname", nullable = false)
    private String className;
    @Column(name = "userid", nullable = false)
    private Long userId;
    @Column(name = "busiid", nullable = false)
    private Long busiId;

    @Column(name = "describle", nullable = false)
    private String describle;
    @Column
    private String remark;
    @Column(name = "createtime")
    private Date createTime;
    @Column(nullable = false)
    private int state = 1;
    @Column
    private String uname;
    @Column
    private String sname;

    @OneToOne(cascade = CascadeType.ALL)
    @JoinColumn(name = "stuid", referencedColumnName = "id", insertable = false, updatable = false)
    private Student student;

    @OneToOne(cascade = CascadeType.ALL)
    @JoinColumn(name = "userid", referencedColumnName = "id", insertable = false, updatable = false)
    private User user;

    @OneToOne(cascade = CascadeType.ALL)
    @JoinColumn(name = "busiid", referencedColumnName = "id", insertable = false, updatable = false)
    private Busi busi;

    @OneToMany(cascade = CascadeType.ALL, mappedBy = "enrollId", fetch = FetchType.EAGER)
    private List<EnrollExtFields> enrollExtFields;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getStuId() {
        return stuId;
    }

    public void setStuId(Long stuId) {
        this.stuId = stuId;
    }

    public String getGrade() {
        return grade;
    }

    public void setGrade(String grade) {
        this.grade = grade;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getBusiId() {
        return busiId;
    }

    public void setBusiId(Long busiId) {
        this.busiId = busiId;
    }

    public String getDescrible() {
        return describle;
    }

    public void setDescrible(String describle) {
        this.describle = describle;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public Student getStudent() {
        return student;
    }

    public void setStudent(Student student) {
        this.student = student;
    }

    public List<EnrollExtFields> getEnrollExtFields() {
        return enrollExtFields;
    }

    public void setEnrollExtFields(List<EnrollExtFields> enrollExtFields) {
        this.enrollExtFields = enrollExtFields;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Busi getBusi() {
        return busi;
    }

    public void setBusi(Busi busi) {
        this.busi = busi;
    }

    public String getDep() {
        return dep;
    }

    public void setDep(String dep) {
        this.dep = dep;
    }

    public String getUname() {
        return uname;
    }

    public void setUname(String uname) {
        this.uname = uname;
    }

    public String getSname() {
        return sname;
    }

    public void setSname(String sname) {
        this.sname = sname;
    }
}
